package cn.lg.soar.database.base.entity;

import cn.lg.soar.common.util.jackson.serializer.IdAutoSerializer;
import com.baomidou.mybatisplus.annotation.TableField;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;

import java.io.Serializable;

/**
 * 树形数据，使用id链实现
 * @author luguoxiang
 * 开源项目：https://gitee.com/lgx1992/lg-soar 求star！请给我star！请帮我点个star！
 */
@Schema(description = "树形数据基础")
@EqualsAndHashCode(callSuper=false)
@Getter
@Setter
public abstract class TreeEntity<ID extends Serializable> extends BaseEntity implements ITreeEntity<ID> {

    private static final long serialVersionUID = 2562184700379561956L;

    @JsonSerialize(using = IdAutoSerializer.class)
    @Schema(description = "父id")
    @TableField(value = IPathTreeEntity.PARENT_ID)
    protected ID parentId;

}
